<style scoped lang="scss">
	.yd {
		display: block;
		width: 100%;
		height: 95vh;
	}

	.btn {
		display: flex;
		justify-content: center;
		align-items: center;
		width: R(500);
		height: R(60);
		background-color: #6691ff;
		border-radius: R(10);
		color: #fff;
		font-size: R(24);
		margin: R(40) auto 0;
	}

	.icon-download {
		margin-left: R(10);
	}

	.bgBox {
		background-color: #fbfcff;
		overflow: hidden;
	}
</style>
<template>
	<div class="bgBox">
		<div class="btn" @click="download()">苹果app下载 <span class="iconfont icon-download"></span></div>
		<image class="yd" :src="require('@/common/images/downApp/yd.png')">
	</div>
</template>

<script>
	import {
		appDownloadUrl,
		getSysParam,
		centerDept
	} from '_a/sms';
	export default {
		name: "invitation/downIos",
		data() {
			return {
				apkFile: ''
			};
		},
		computed: {
			appConfig() {
				return this.$store.getters.appConfig || null
			}
		},
		created() {

		},
		methods: {
			async download() {
				let res={};
				let hostname = window.location.hostname
				console.log({hostname});
				if (hostname == 'app.shou-kuanbao.com') {
					// 系统app
					//window.location.href = `${window.location.origin}/kj/kj.mobileconfig`;
					//window.location.href = `${window.location.origin}/kj/skb_agent.mobileconfig`;
					window.location.href = 'https://file.shou-kuanbao.com/agent/download/skb/skb_agent.mobileconfig';
				} else {
					if(this.appConfig && this.appConfig.iosPath) {
						res.msg = this.appConfig.iosPath || ''
					}else{
						res.msg = 'download/newapp/agent_app.mobileconfig';
					}
					console.log(res.msg,this.appConfig);
				}
				if (res.msg) {
					this.apkFile = res.msg;
					const newDomain = "https://file.shou-kuanbao.com"; // 替换为你的新域名
					const downloadUrl = `${newDomain}/agent/${this.apkFile}`;
					window.location.href = downloadUrl;
				} else {
					this.$tip.toast('请联系管理员上传app!');
				}
				console.log(window.location.href)
			}
		}
	};
</script>